﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using OFB.BLL.Context;

namespace OFB.BLL.Repository
{
    public class ReportTopicBLL
    {
        private ReportTopicContext context;

        public ReportTopicBLL()
        {
            context = new ReportTopicContext();
        }

        public ICollection<Domain.Topic> GetTopics(string trainerId, int subjectId,
            int courseId)
        {
            //Gọi context Init(), truyền store procedure name là Report_GetTopics và parameter
            //Map dữ liệu trả về cho class Topic
            //return các object Topic
            return context.Topic.Init("Report_GetTopics",
                context.Topic.BuildParameter("CourseId", System.Data.DbType.Int32, courseId),
                context.Topic.BuildParameter("SubjectId", System.Data.DbType.Int32, subjectId),
                context.Topic.BuildParameter("TrainerId", System.Data.DbType.String, trainerId)
                )
                .MapCollection<Domain.Topic>().GetCollection();
        }
    }
}
